/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "instruccion", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "Instruccion.findAll", query = "SELECT i FROM Instruccion i"),
    @NamedQuery(name = "Instruccion.findByIdInstruccion", query = "SELECT i FROM Instruccion i WHERE i.idInstruccion = :idInstruccion"),
    @NamedQuery(name = "Instruccion.findByInsGrado", query = "SELECT i FROM Instruccion i WHERE i.insGrado = :insGrado")})
public class Instruction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_instruccion")
    private Integer id;
    @Column(name = "ins_grado")
    private String grade;
    @JoinColumn(name = "vis_id_visita_domiciliaria", referencedColumnName = "id_visita_domiciliaria")
    @ManyToOne(optional = false)
    private HomeVisit homeVisit;
    @JoinColumn(name = "mie_id_miembro", referencedColumnName = "id_miembro")
    @ManyToOne(optional = false)
    private Member member;

    public Instruction() {
    }

    public Instruction(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public HomeVisit getHomeVisit() {
        return homeVisit;
    }

    public void setHomeVisit(HomeVisit homeVisit) {
        this.homeVisit = homeVisit;
    }

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Instruction)) {
            return false;
        }
        Instruction other = (Instruction) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.Instruction[ id=" + id + " ]";
    }
    
}
